<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddRefundReasonToWaimaiOrder extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('waimai_orders', function (Blueprint $table) {
            $table->string('refundReason', 128)->default('')->comment('取消订单的理由')->after('remark');
            $table->string('refundPic', 256)->default('')->comment('取消订单的图片')->after('refundReason');
            $table->string('rejectReason', 128)->default('')->comment('商家拒绝退款的理由')->after('refundPic');
        });

        // 改长度1024
        \Illuminate\Support\Facades\DB::connection('mysql')->statement("ALTER TABLE `kf_rms`.`kf_waimai_orders` 
MODIFY COLUMN `redLists` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '活动列表json存' AFTER `redPrice`;");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('waimai_orders', function (Blueprint $table) {
            $table->dropColumn('refundReason');
            $table->dropColumn('refundPic');
            $table->dropColumn('rejectReason');
        });
    }
}
